﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microhard.Permission.Interface;
using Microsoft.Practices.Unity;
using Microhard.Permission.MVCFilter;
using Microhard.Core.DBUtility;
using Micrhard.FMCG.Server.Impl;
using Microhard.Plat.CRM.Stores.Models;
using Microhard.Plat.CRM.Stores.Interface;

namespace Microhard.Plat.CRM.WebUI.Areas.Stores.Controllers
{
    public class KAPrdDisplayController : MicroHardBaseController<ProductDisplayImageModel>
    {
        private IProductDisplayImage _resp = null;
        [Dependency]
        public IProductDisplayImage Category
        {
            set
            {
                base._repository = value;
                _resp = value;
            }
            get
            {
                return _resp;
            }
        }

        [MVCFilterAtrForLogon(Order = 0)]//登录验证
        [MVCFilterAtrForResourcePermission(OperationKeyName = "Index", Order = 1)]//功能权限验证
        public ActionResult GetPrdDisplayImage(Guid identity, ScopeResult scope)
        {
            _resp.scope = scope;
            var model = _resp.GetModelByID(identity);
            byte[] bys = model.Conetnt;
            return File(bys, "image/jpeg");
        }

        [HttpPost]
        [MVCFilterAtrForLogon(Order = 0)]//登录验证
        [MVCFilterAtrForResourcePermission(OperationKeyName = "Delete", Order = 1)]//功能权限验证
        public ActionResult DeleteImage(List<Guid> identities, ScopeResult scope)
        {
            return base.Delete(identities, scope);
        }

    }
}
